From 291370e367f9c51f894ff132860ac2b55727181f Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 30 May 2015 00:23:34 +0100 Subject: Fix Destroy() calling behaviour * Fixes Core/#142 --- src/ClientHandle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 9cba5619d..e3f63b091 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -2181,11 +2181,12 @@ void cClientHandle::SendDestroyEntity(const cEntity & a_Entity) void cClientHandle::SendDisconnect(const AString & a_Reason) { + // Destruction (Destroy()) is called when the client disconnects, not when a disconnect packet (or anything else) is sent + // Otherwise, the cClientHandle instance is can be unexpectedly removed from the associated player - Core/#142 if (!m_HasSentDC) { LOGD("Sending a DC: \"%s\"", StripColorCodes(a_Reason).c_str()); m_Protocol->SendDisconnect(a_Reason); - Destroy(); m_HasSentDC = true; } } -- cgit v1.2.3